package com.dyh.quickdemozwei.controller.http;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.Charset;

public class PlainHttpBody implements HttpBody {

	private String content;
	
	public PlainHttpBody(String content) {
		this.content = content;
	}
	
	@Override
	public InputStream toInputStream(HttpContext context) {
		Charset charset = context.getCharset();
		return new ByteArrayInputStream(content.getBytes(charset));
	}
}
